package com.biostime.rpc.terminal.constant;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import com.biostime.rpc.terminal.thrift.TerminalService;
import com.mama100.common.finagle.FinagleClientRegister;

/**
 * <p>
 * 说明
 * </p>
 *
 * @author yangrzh 2014/7/31
 */
public class OrderRpcFactory {

    private Logger log = LoggerFactory.getLogger(OrderRpcFactory.class);

    private FinagleClientRegister register;
    private TerminalService.ServiceIface terminalService;

    public synchronized TerminalService.ServiceIface getTerminalService() {
        if (terminalService == null) {
            try {
                terminalService = (TerminalService.ServiceIface) register.getClientService("terminalService", TerminalService.class.getName());
            } catch (Exception e) {
                log.error("register TerminalService error", e);
            }
        }
        return terminalService;
    }

	public FinagleClientRegister getRegister() {
        return register;
    }

    public void setRegister(FinagleClientRegister register) {
        this.register = register;
    }
}
